[
  {
    "name": "createTank",
    "body": "mutation createTank($input: _CreateTankInput!) {\n  packet {\n    createTank(input: $input) {\n      ...TankAttributes\n    }\n  }\n}\n    fragment TankAttributes on _E_Tank {\n  id\n  __typename\n  tankOpenDate\n  currentVal\n  location {\n    latitude\n    longitude\n  }\n  tankType {\n    id\n    name\n  }\n  owner {\n    entityId\n  }\n}",
    "allowEmptyChecks": false,
    "disableJwtVerification": false,
    "checkSelects": [
      {
        "conditionValue": "'tank-manager' $in ${[]:jwt:realm_access.roles}",
        "typeName": null,
        "description": "Только пользователь с ролью tank-manager может создавать резервуары"
      }
    ]
  },
  {
    "name": "decreaseTankVal",
    "body": "mutation decreaseTankVal($tankId: ID!, $val: BigDecimal!, $transferRef: _SingleReferenceInput) {\n  packet {\n    updateTank(\n      input: {id: $tankId}\n      inc: {currentVal: {value: $val, negative: true}}\n    ) {\n      id\n      __typename\n      currentVal\n    }\n    createTankOperation(\n      input: {tank: $tankId, val: $val, kind: OUTPUT, transfer: $transferRef}\n    ) {\n      ...TankOperationAttributes\n    }\n  }\n}\n    fragment TankOperationAttributes on _E_TankOperation {\n  id\n  __typename\n  kind\n  val\n  transfer {\n    entityId\n  }\n  aggregateRoot {\n    id\n  }\n}",
    "allowEmptyChecks": false,
    "disableJwtVerification": false,
    "checkSelects": [
      {
        "conditionValue": "${BigDecimal:val} > 0 && it.$id == ${tankId} && it.currentVal - ${BigDecimal:val} >= it.tankType.minVal\n&& it.owner.entityId == ${jwt:email}",
        "typeName": "Tank",
        "description": "- не выходим за нижнюю границу объема резервуара\n- операцию выполняет владелец резервуара"
      }
    ]
  },
  {
    "name": "deleteTank",
    "body": "mutation deleteTank($id: ID!) {\n  packet {\n    deleteTank(id: $id)\n  }\n}",
    "allowEmptyChecks": true,
    "disableJwtVerification": false
  },
  {
    "name": "increaseTankVal",
    "body": "mutation increaseTankVal($tankId: ID!, $val: BigDecimal!, $transferRef: _SingleReferenceInput) {\n  packet {\n    updateTank(input: {id: $tankId}, inc: {currentVal: {value: $val}}) {\n      id\n      __typename\n      currentVal\n    }\n    createTankOperation(\n      input: {tank: $tankId, val: $val, kind: INPUT, transfer: $transferRef}\n    ) {\n      ...TankOperationAttributes\n    }\n  }\n}\n    fragment TankOperationAttributes on _E_TankOperation {\n  id\n  __typename\n  kind\n  val\n  transfer {\n    entityId\n  }\n  aggregateRoot {\n    id\n  }\n}",
    "allowEmptyChecks": false,
    "disableJwtVerification": false,
    "checkSelects": [
      {
        "conditionValue": "${BigDecimal:val} > 0 && it.$id == ${tankId} && it.currentVal + ${BigDecimal:val} <= it.tankType.maxVal\n&& it.owner.entityId == ${jwt:email}",
        "typeName": "Tank",
        "description": "- не выходим за нижнюю границу объема резервуара\n- операцию выполняет владелец резервуара\n"
      }
    ]
  },
  {
    "name": "searchTank",
    "body": "query searchTank($cond: String) {\n  searchTank(cond: $cond) {\n    elems {\n      ...TankAttributes\n    }\n  }\n}\n    fragment TankAttributes on _E_Tank {\n  id\n  __typename\n  tankOpenDate\n  currentVal\n  location {\n    latitude\n    longitude\n  }\n  tankType {\n    id\n    name\n  }\n  owner {\n    entityId\n  }\n}",
    "allowEmptyChecks": false,
    "disableJwtVerification": false,
    "checkSelects": [
      {
        "conditionValue": "'tank-manager' $in ${[]:jwt:realm_access.roles} || 'tank-worker' $in ${[]:jwt:realm_access.roles}",
        "typeName": null,
        "description": "Только пользователи с ролями tank-manager и tank-worker могут просматривать информацию о резервуарах"
      }
    ],
    "paramAdditions": [
      {
        "paramName": "cond",
        "paramAddition": "'tank-manager' $in ${[]:jwt:realm_access.roles} || ${jwt:email} == it.owner.entityId"
      }
    ]
  },
  {
    "name": "searchTankOperation",
    "body": "query searchTankOperation($cond: String) {\n  searchTankOperation(cond: $cond) {\n    elems {\n      ...TankOperationAttributes\n    }\n  }\n}\n    fragment TankOperationAttributes on _E_TankOperation {\n  id\n  __typename\n  kind\n  val\n  transfer {\n    entityId\n  }\n  aggregateRoot {\n    id\n  }\n}",
    "allowEmptyChecks": true,
    "disableJwtVerification": false,
    "paramAdditions": [
      {
        "paramName": "cond",
        "paramAddition": ""
      }
    ]
  },
  {
    "name": "searchTankType",
    "body": "query searchTankType {\n  searchTankType {\n    elems {\n      ...TankTypeAttributes\n    }\n  }\n}\n    fragment TankTypeAttributes on _E_TankType {\n  id\n  __typename\n  name\n  minVal\n  maxVal\n  measure {\n    id\n    __typename\n    name\n  }\n}",
    "allowEmptyChecks": true,
    "disableJwtVerification": false,
    "paramAdditions": [
      {
        "paramName": "",
        "paramAddition": ""
      }
    ]
  },
  {
    "name": "updateTank",
    "body": "mutation updateTank($input: _UpdateTankInput!) {\n  packet {\n    updateTank(input: $input) {\n      ...TankAttributes\n    }\n  }\n}\n    fragment TankAttributes on _E_Tank {\n  id\n  __typename\n  tankOpenDate\n  currentVal\n  location {\n    latitude\n    longitude\n  }\n  tankType {\n    id\n    name\n  }\n  owner {\n    entityId\n  }\n}",
    "allowEmptyChecks": true,
    "disableJwtVerification": false
  }
]